﻿package com.schimanek.objects 
{
	import flash.utils.ByteArray;
	import flash.utils.getDefinitionByName;
	
	/**
	 * ...
	 * @author Gregor Schimanek
	 */
	public class ObjectUtils 
	{
		
		public function ObjectUtils() 
		{
			
		}
		
		public static function clone(value:Object):Object
		{
			//trace(getDefinitionByName(value.toString()));
			var sClass:String = value.toString();
			
			sClass = sClass.slice(sClass.indexOf(" ")+1,sClass.length-1);
			trace(sClass);
			//getDefinitionByName(typeof value);
			var byteArray:ByteArray = new ByteArray();
			byteArray.writeObject(value);
			byteArray.position = 0;
			trace(byteArray.readObject());
			
			//return byteArray.readObject() as sClass;
			return byteArray.readObject();
		}
	
		
	}
	
}